#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;
using vegl = vector < pair < int, ll > >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 1e5 + 10;

int n, Q, A;
veg G[N];

namespace L {
	const int N = 2e5 + 10;
	const int K = 21;
	int stk[N], dep[N], tot, dfn[N], R[N], mn[K + 1][N], lg[N], pw[K + 10];
	ll tdep[N];
	void dfs(int x, int p) {
		stk[dfn[x] = R[x] = ++tot] = x; dep[x] = dep[p] + 1; int y, w;
		for(auto v : G[x]) {
			tie(y, w) = v; if(y == p) continue;
			tdep[y] = tdep[x] + w; dfs(y, x); stk[R[x] = ++tot] = x; 
		}
	}
	inline int tmn(int x, int y) { return dep[x] < dep[y] ? x : y; }
	inline int LCA(int x, int y) { if(dfn[x] > dfn[y]) swap(x, y); x = dfn[x]; y = R[y]; int k = lg[y - x + 1]; return tmn(mn[k][x], mn[k][y - pw[k] + 1]); }
	inline ll dis(int x, int y) { return tdep[x] + tdep[y] - tdep[LCA(x, y)] * 2; }
	void build() {
		dfs(1, 0); rep(i, 2, tot) lg[i] = lg[i >> 1] + 1;
		pw[0] = 1; rep(i, 1, K) pw[i] = pw[i - 1] * 2;
		rep(i, 1, tot) mn[0][i] = stk[i];
		rep(i, 1, K) rep(j, 1, tot - pw[i] + 1) mn[i][j] = tmn(mn[i - 1][j], mn[i - 1][j + pw[i - 1]]);
	}
}

namespace T {
	int fa[N], siz[N], son[N], rt, d[N];
	ll totd[N], sumd[N], sumfa[N];
	bool vis[N];
	void gsz(int x, int p) {
		siz[x] = 1; son[x] = 0; for(auto v : G[x]) if(!vis[v.fi] && v.fi ^ p) gsz(v.fi, x), siz[x] += siz[v.fi], chkmax(son[x], siz[v.fi]);
	}
	void grt(int x, int p, int tsz) {
		for(auto v : G[x]) if(!vis[v.fi] && v.fi ^ p) grt(v.fi, x, tsz); chkmax(son[x], tsz - siz[x]); if(rt == 0 || son[x] < son[rt]) rt = x;
	}
	veg tG[N];
	int divide(int x) {
		gsz(x, 0); rt = 0; grt(x, 0, siz[x]); x = rt; vis[x] = true; int t = 0;
		for(auto v : G[x])
			if(!vis[v.fi]) fa[t = divide(v.fi)] = x, tG[x].eb(t, v.fi);
		return x;
	}
	void upd(int x, int v) {
		d[x] += v; int lx = x;
		while(x) {
			totd[x] += v; sumd[x] += 1ll * L :: dis(lx, x) * v;
			if(fa[x]) sumfa[x] += 1ll * L :: dis(lx, fa[x]) * v;
			x = fa[x];
		}
	}
	ll calc(int x) {
		ll res = sumd[x]; int lx = x;
		for(int y = fa[x]; y; x = y, y = fa[y]) {
			int dist = L :: dis(lx, y);
			res += (sumd[y] - sumfa[x]) + 1ll * (totd[y] - totd[x]) * dist;
		}
		return res;
	}
	ll query(int x) {
		ll res = calc(x);
		for(auto y : tG[x]) 
			if(calc(y.se) <= res) return query(y.fi);
	    return res;
	}
	int trt;
	void build() { trt = divide(1); }
}

int stu[N];

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	n = in; Q = in;
	rep(i, 2, n) { int u = in, v = in, w = in; G[u].eb(v, w), G[v].eb(u, w); }
	L :: build(); T :: build();
	while(Q--) {
		int x = in, v = in;
		T :: upd(x, v); printf("%lld\n", T :: query(T :: trt));
	}
	return 0;
}
